package com.allen.retrofit2_rxjava2.view.selectImage.utils;

import android.content.Context;
import android.content.res.Resources;

/**
 * Created by lierdong on 2016/12/5.
 */
public class SizeUtils {

    public static int dp2px(Context context,int dp){
        final float scale = context.getResources().getDisplayMetrics().density;
        return (int) (dp * scale + 0.5f);
    }

    public static int dp2px(int dp) {
        final float scale = Resources.getSystem().getDisplayMetrics().density;
        return (int) (dp * scale + 0.5f);
    }
}
